﻿Imports TMySQL
Public Class frmServerInfo
    Implements ITabForm
    Private _ServerInfo As TMyServerInfo
    Public Sub New()
        ' この呼び出しは、Windows フォーム デザイナで必要です。
        InitializeComponent()
        ' InitializeComponent() 呼び出しの後で初期化を追加します。
        InitFrm()
    End Sub
    Private Sub InitFrm()
        frmMain.GridSettings.Apply(Grid)
        _ServerInfo = New TMyServerInfo(frmMain.Connection)
        cboStatus.Items.Clear()
        For i As Integer = 0 To _ServerInfo.DisplayItemCount - 1
            cboStatus.Items.Add(_ServerInfo.DisplayItem(i))
        Next
        cboStatus.SelectedIndex = _ServerInfo.SelectedIndex
    End Sub

    Private Sub cmdRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRefresh.Click
        Cursor.Current = Cursors.WaitCursor
        Try
            _ServerInfo.Condition = txtCondition.Text
            ShowResult()
        Finally
            Cursor.Current = Cursors.Default
        End Try
    End Sub

    Private Sub ShowResult()
        _ServerInfo.SelectedIndex = cboStatus.SelectedIndex
        _ServerInfo.Refresh()
        Grid.DataSource = _ServerInfo.DataTable
    End Sub
End Class